package com.eleclab.modele;

import com.eleclab.traitement.Complexe;

/* TODO
 * - Ajouter les attributs
 * - Ajouter constructeur, setters, getters
 */

public class Bobine extends Composant{
    
    float inductance; // Attention valeur en mH
    
        
    public Bobine (String aNom, int ax,int ay, float aInductance, char aOrientation) {
        super(aNom,"bobine",ax,ay, aOrientation, "bobine");
        this.inductance=aInductance;
        calculImpedance();
        System.out.println("Frequence prise en compte : "+Generateur.frequence);
    }
    
    public void calculImpedance(){
        this.impedance=new Complexe (0,2*Math.PI*(double)(Generateur.frequence)*this.inductance*0.001);
    }
    
    public Complexe calculImpedanceGraph (float w){
        return new Complexe (0,(double)(w)*this.inductance*0.001);
    }

    
    public void setValeur(float newValeur){
        if(newValeur>0){
            inductance=newValeur;
        } else {
            System.out.println("inductance non positive!");
            
        }
    }
    
    public float getValeur(){
        return this.inductance;
    }
}
